VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} d_meta_file 
   Caption         =   "Open file with drawing commands"
   ClientHeight    =   3135
   ClientLeft      =   45
   ClientTop       =   585
   ClientWidth     =   18360
   OleObjectBlob   =   "d_meta_file.frx":0000
   StartUpPosition =   1  'CenterOwner
End
Attribute VB_Name = "d_meta_file"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' **********************
' DEFAULTs and CONSTANTS
' **********************

Private Const DEF_TILESPACE = 20#
Private Const TEXTFONT = "Arial"
Private Const TEXTSPACING = 3#
Private Const LEGENDWIDTH = 20#
Private Const LEGENDHEIGHT = 10#
Private Const THUMBNAILHEIGHT = 20#
Private Const THUMBNAILWIDTH = 20#

' ********************
' OPEN DIALOG
' ********************


'API declarations
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OpenFilename) As Long
Private Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

'data buffer for the GetOpenFileName and GetSaveFileName functions
Private Type OpenFilename
        lStructSize As Long
        hwndOwner As Long
        hInstance As Long
        lpstrFilter As String
        lpstrCustomFilter As String
        nMaxCustFilter As Long
        iFilterIndex As Long
        lpstrFile As String
        nMaxFile As Long
        lpstrFileTitle As String
        nMaxFileTitle As Long
        lpstrInitialDir As String
        lpstrTitle As String
        flags As Long
        nFileOffset As Integer
        nFileExtension As Integer
        lpstrDefExt As String
        lCustData As Long
        lpfnHook As Long
        lpTemplateName As String
End Type

'Open file dialog flag
Private Const OFN_HIDEREADONLY = &H4

'as VBA has no Hwnd(window handle) property, this function will find the Hwnd
Private Function getHwnd()
getHwnd = FindWindow("ThunderDFrame", "Common Open Dialog Example")
End Function



Private Sub b_cancel_Click()
    End
End Sub


Private Sub b_OK_Click()
    d_meta_file.Hide
End Sub






' ******************
' COLORSWATCH DIALOG
' ******************

Private Sub UserForm_Initialize()
    b_OK.SetFocus
End Sub



Private Sub ButtonSelectFile_Click()
    'Ask user for the palette file
    Dim FileName As String
    Dim ofn As OpenFilename
    Dim strFilter As String
    Dim lngApiReturn As Long
    
    'set up filter
    strFilter = "All Files (*.*)" & Chr(0) & "*.*"
    
    'initialize the ofn structure
    ofn.lStructSize = Len(ofn)
    ofn.flags = OFN_HIDEREADONLY
    ofn.hwndOwner = getHwnd
    ofn.lpstrFilter = strFilter
    ofn.iFilterIndex = 1
    ofn.lpstrFile = String(257, 0)
    ofn.nMaxFile = Len(ofn.lpstrFile) - 1
    ofn.lpstrFileTitle = ofn.lpstrFile
    ofn.nMaxFileTitle = ofn.nMaxFile
    ofn.lpstrTitle = "Open Drawing Commands File"
    ofn.lpstrInitialDir = CurDir
    
    'call the API function
    lngApiReturn = GetOpenFileName(ofn)

    If lngApiReturn <> 0 Then
        efile_name.Value = ofn.lpstrFile
    End If
    Exit Sub
ErrorOpenFile:
    MsgBox "Unable to open " & FileName
End Sub


